// SKU模块的接口管理
import request from "@/utils/request";
import { skuResponseData, SkuInfoData } from "./type";
enum API {
    // 获取已有的商品的数据
    SKU_URL = '/admin/product/list/',
    // 下架商品
    CANCEL_URL = '/admin/product/cancelSale/',
    // 上架商品
    SALE_URL = '/admin/product/onSale/',
    // 获取商品详情
    SKUINFO_URL = '/admin/product/getSkuInfo/',
    // 删除已有的商品
    DELETESKU_URL = '/admin/product/deleteSku/'
}
// 获取已有的商品SKU的接口
export const reqSkuList = (page: number, limit: number) => request.get<any, skuResponseData>(API.SKU_URL + `${page}/${limit}`)
// 已有商品上架的请求
export const reqSaleSku = (skuId: number) => request.get<any, any>(API.SALE_URL + `${skuId}`)
// 已有商品下架的请求
export const reqCancelSaleSku = (skuId: number) => request.get<any, any>(API.CANCEL_URL + `${skuId}`)
// 获取商品详情
export const reqSkuInfo = (skuId: number) => request.get<any, SkuInfoData>(API.SKUINFO_URL + `${skuId}`)
// 删除某个已有的商品
export const reqRemoveSku = (skuId: number) => request.delete<any, any>(API.DELETESKU_URL + `${skuId}`)